Skip to content

windows: identify standard streams by console handle, not value identity - #90

Open
ndeloof wants to merge 1 commit into
containerd:mainfrom
ndeloof:file-handle-identity
Open

windows: identify standard streams by console handle, not value identity#90
ndeloof wants to merge 1 commit into
containerd:mainfrom
ndeloof:file-handle-identity

Conversation

@ndeloof

@ndeloof ndeloof commented Aug 19, 2026

Copy link
Copy Markdown

On Windows, newMaster rejected any File that was not literally os.Stdin, os.Stdout or os.Stderr — a Go pointer-identity check. Callers commonly hand over a wrapper decorating a standard stream to satisfy the File interface (their CLI stream types don't implement it directly); such a wrapper reports the very same console handle through Fd() and designates the same console object, yet was rejected with creating a console from a file is not supported on windows.

Concrete fallout: docker/compose#14086 — compose's build progress passes its CLI output stream wrapped as a File, so the TTY rendering could never engage on Windows: silent fallback to plain in auto mode, hard failure with --progress=tty.

This PR compares the underlying handles instead. The invariant is unchanged — only the process's standard streams are accepted, since the console-mode operations act on those handles — but it is now expressed against the console object rather than the Go value. Wrappers over any other handle stay rejected.

Includes a unit test covering the three std streams, their wrapped forms, and the rejection of regular-file handles; it runs in headless CI since initStdios tolerates redirected streams.

newMaster rejected any File that was not literally os.Stdin, os.Stdout
or os.Stderr — a Go pointer-identity check. Callers commonly hand over
a wrapper decorating a standard stream to satisfy the File interface
(their CLI stream types don't implement it directly); such a wrapper
reports the very same console handle through Fd() and designates the
same console object, yet was rejected with "creating a console from a
file is not supported on windows".

Concrete fallout: docker/compose#14086 — the compose build progress
passes its CLI stream wrapped as a File, so the TTY rendering could
never engage on Windows (silent fallback to plain in auto mode, hard
failure with --progress=tty).

Compare the underlying handles instead: the invariant is unchanged —
only the process's standard streams are accepted, since the
console-mode operations act on those handles — but it is now expressed
against the console object rather than the Go value.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant